package app.excel.cartoon.style;

import cn.lily.com.file.excel.css.ExcelWriterStyle;
import cn.lily.com.file.excel.io.ExcelWriter;
import cn.lily.com.file.excel.spe.IExcelBorder;
import cn.lily.com.file.excel.spe.IExcelColor;

public class ExcelCartoonStyle {
	
	private ExcelWriterStyle titleStyle;
	private ExcelWriterStyle contentStyle;
	
	private  ExcelWriterStyle redStyle;
	private  ExcelWriterStyle greenStyle;
	private  ExcelWriterStyle yellowStyle;
	private  ExcelWriterStyle blueStyle;
	private  ExcelWriterStyle orangeStyle;
	private  ExcelWriterStyle grayStyle;
	private  ExcelWriterStyle pinkStyle;
	
	private ExcelWriterStyle contentLeftStyle;
	private  ExcelWriterStyle redLeftStyle;
	private  ExcelWriterStyle greenLeftStyle;
	private  ExcelWriterStyle yellowLeftStyle;
	private  ExcelWriterStyle blueLeftStyle;
	private  ExcelWriterStyle orangeLeftStyle;
	private  ExcelWriterStyle grayLeftStyle;
	private  ExcelWriterStyle pinkLeftStyle;
	
	
	public void loadTitleStyle(ExcelWriter excelWriter){
		
		titleStyle = new ExcelWriterStyle(excelWriter);
		
		titleStyle.getCell().setCellAlign("center")
							.setCellVetical("center")
							.setBackGroundColor(IExcelColor.BLACK)
							.setBorder("bottom", IExcelBorder.BORDER_DOUBLE)
							.setBorder("top", IExcelBorder.BORDER_DOUBLE)
							.setBorder("right", IExcelBorder.BORDER_DOUBLE)
							.setBorder("left", IExcelBorder.BORDER_DOUBLE)
							.setBorderColor("bottom", IExcelColor.GREY_25_PERCENT)
							.setBorderColor("top", IExcelColor.GREY_25_PERCENT)
							.setBorderColor("right", IExcelColor.GREY_25_PERCENT)
							.setBorderColor("left", IExcelColor.GREY_25_PERCENT);
		
		titleStyle.getFont().setFontColor(IExcelColor.WHITE)
			                .setFontSize(12)
			                .setFontBorder();
		
	}
	
	public void loadContentStyle(ExcelWriter excelWriter){
		
		contentStyle = new ExcelWriterStyle(excelWriter);
		
		contentStyle.getCell().setCellAlign("center")
								.setCellVetical("center")
								.setBorder("bottom", IExcelBorder.BORDER_DOUBLE)
								.setBorder("top", IExcelBorder.BORDER_DOUBLE)
								.setBorder("right", IExcelBorder.BORDER_DOUBLE)
								.setBorder("left", IExcelBorder.BORDER_DOUBLE)
								.setBorderColor("bottom", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("top", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("right", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("left", IExcelColor.GREY_25_PERCENT)
								.setWrapText();
		
		contentStyle.getFont().setFontColor(IExcelColor.BLACK)
			                  .setFontSize(8);
		
		this.redStyle = loadColorStyle(excelWriter, redStyle, IExcelColor.RED);
		this.pinkStyle = loadColorStyle(excelWriter, pinkStyle, IExcelColor.ROSE);
		this.orangeStyle = loadColorStyle(excelWriter, orangeStyle, IExcelColor.LIGHT_ORANGE);
		this.yellowStyle = loadColorStyle(excelWriter, yellowStyle, IExcelColor.LIGHT_YELLOW);
		this.blueStyle = loadColorStyle(excelWriter, blueStyle, IExcelColor.LIGHT_BLUE);
		this.greenStyle = loadColorStyle(excelWriter, greenStyle, IExcelColor.LIGHT_GREEN);
		this.grayStyle = loadColorStyle(excelWriter, grayStyle, IExcelColor.GREY_40_PERCENT);
		
	}
	
	private ExcelWriterStyle loadColorStyle(ExcelWriter excelWriter,ExcelWriterStyle excelStyle,short color){
		
		excelStyle = new ExcelWriterStyle(excelWriter);
		
		excelStyle.getCell().setCellAlign("center")
								.setCellVetical("center")
								.setBorder("bottom", IExcelBorder.BORDER_DOUBLE)
								.setBorder("top", IExcelBorder.BORDER_DOUBLE)
								.setBorder("right", IExcelBorder.BORDER_DOUBLE)
								.setBorder("left", IExcelBorder.BORDER_DOUBLE)
								.setBorderColor("bottom", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("top", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("right", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("left", IExcelColor.GREY_25_PERCENT)
								.setWrapText()
								.setBackGroundColor(color);
		
		excelStyle.getFont().setFontColor(IExcelColor.BLACK)
			                  .setFontSize(8);
		
		return excelStyle;
	}
	
	public void loadContentLeftStyle(ExcelWriter excelWriter){
		
		contentLeftStyle = new ExcelWriterStyle(excelWriter);
		
		contentLeftStyle.getCell().setCellAlign("left")
								.setCellVetical("center")
								.setBorder("bottom", IExcelBorder.BORDER_DOUBLE)
								.setBorder("top", IExcelBorder.BORDER_DOUBLE)
								.setBorder("right", IExcelBorder.BORDER_DOUBLE)
								.setBorder("left", IExcelBorder.BORDER_DOUBLE)
								.setBorderColor("bottom", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("top", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("right", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("left", IExcelColor.GREY_25_PERCENT)
								.setWrapText();
		
		contentLeftStyle.getFont().setFontColor(IExcelColor.BLACK)
			                  .setFontSize(8);
		
		this.redLeftStyle = loadColorLeftStyle(excelWriter, redStyle, IExcelColor.RED);
		this.pinkLeftStyle = loadColorLeftStyle(excelWriter, pinkStyle, IExcelColor.ROSE);
		this.orangeLeftStyle = loadColorLeftStyle(excelWriter, orangeStyle, IExcelColor.LIGHT_ORANGE);
		this.yellowLeftStyle = loadColorLeftStyle(excelWriter, yellowStyle, IExcelColor.LIGHT_YELLOW);
		this.blueLeftStyle = loadColorLeftStyle(excelWriter, blueStyle, IExcelColor.LIGHT_BLUE);
		this.greenLeftStyle = loadColorLeftStyle(excelWriter, greenStyle, IExcelColor.LIGHT_GREEN);
		this.grayLeftStyle = loadColorLeftStyle(excelWriter, grayStyle, IExcelColor.GREY_40_PERCENT);
		
	}
	
	private ExcelWriterStyle loadColorLeftStyle(ExcelWriter excelWriter,ExcelWriterStyle excelStyle,short color){
		
		excelStyle = new ExcelWriterStyle(excelWriter);
		
		excelStyle.getCell().setCellAlign("left")
								.setCellVetical("center")
								.setBorder("bottom", IExcelBorder.BORDER_DOUBLE)
								.setBorder("top", IExcelBorder.BORDER_DOUBLE)
								.setBorder("right", IExcelBorder.BORDER_DOUBLE)
								.setBorder("left", IExcelBorder.BORDER_DOUBLE)
								.setBorderColor("bottom", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("top", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("right", IExcelColor.GREY_25_PERCENT)
								.setBorderColor("left", IExcelColor.GREY_25_PERCENT)
								.setWrapText()
								.setBackGroundColor(color);
		
		excelStyle.getFont().setFontColor(IExcelColor.BLACK)
			                  .setFontSize(8);
		
		return excelStyle;
	}

	public ExcelWriterStyle getTitleStyle() {
		return titleStyle;
	}

	public ExcelWriterStyle getContentStyle() {
		return contentStyle;
	}

	public ExcelWriterStyle getRedStyle() {
		return redStyle;
	}

	public ExcelWriterStyle getGreenStyle() {
		return greenStyle;
	}

	public ExcelWriterStyle getYellowStyle() {
		return yellowStyle;
	}

	public ExcelWriterStyle getBlueStyle() {
		return blueStyle;
	}

	public ExcelWriterStyle getOrangeStyle() {
		return orangeStyle;
	}

	public ExcelWriterStyle getGrayStyle() {
		return grayStyle;
	}

	public ExcelWriterStyle getPinkStyle() {
		return pinkStyle;
	}

	public ExcelWriterStyle getContentLeftStyle() {
		return contentLeftStyle;
	}

	public ExcelWriterStyle getRedLeftStyle() {
		return redLeftStyle;
	}

	public ExcelWriterStyle getGreenLeftStyle() {
		return greenLeftStyle;
	}

	public ExcelWriterStyle getYellowLeftStyle() {
		return yellowLeftStyle;
	}

	public ExcelWriterStyle getBlueLeftStyle() {
		return blueLeftStyle;
	}

	public ExcelWriterStyle getOrangeLeftStyle() {
		return orangeLeftStyle;
	}

	public ExcelWriterStyle getGrayLeftStyle() {
		return grayLeftStyle;
	}

	public ExcelWriterStyle getPinkLeftStyle() {
		return pinkLeftStyle;
	}
	
	
	
}
